//
function LeagueInfo(name) {
  this.name = name;
  this.transOrders = [];
  this.sizeOrders = [];
}

LeagueInfo.prototype = {
  addTransOrderInfo: function L_addTransOrderInfo(orderInfo) {
    this.transOrders.push(orderInfo);
  },
  addSizeOrderInfo: function L_addSizeOrderInfo(orderInfo) {
    this.sizeOrders.push(orderInfo);
  },
  removeAllOrderInfos: function L_removeAllOrderInfos() {
    this.orderInfos = [];
  }
};

function OrderInfo() {
  this.leagueName = '';
  this.time1 = '';
  this.time2 = '';
  this.homeTeam = '';
  this.awayTeam = '';
  this.homeScore = 0;
  this.awayScore = 0;
  this.homeGates = ['', ''];
  this.awayGates = ['', ''];
  this.gate = '';
  this.homeLevel = '';
  this.awayLevel = '';
  this.homeLevelID = '';
  this.awayLevelID = '';  
}

OrderInfo.prototype = {
  /*
  计算盘口公式
  主网：比分：a:b(0:0, 1:0, 0:1, 1:1, 2:0, 0:2, 1:2, 2:1, 2:2)
  盘口：c:d(0:0, 1:-1, -1:1, 2:-2, -2:2, 3:-3)
  公式：e = c-(a-b); f=d+(a-b); g = e>=0:e?f;
  副网当前盘口：g	
  */
  calcBetGate : function OI_calcBetGate(scoreA, scoreB, gateA) {
    var sub = scoreA * 1 - scoreB * 1;
    if (gateA * 1.0 >= 0 && sub >= 0) {
        return Math.abs(gateA * 1.0 - sub);
      } else if (gateA * 1.0 < 0 && sub > 0) {
        return Math.abs(gateA * 1.0 + sub);
      } else if (gateA * 1.0 >= 0 && sub <= 0) {
        return Math.abs(gateA * 1.0 + sub);
      } else if (gateA * 1.0 < 0 && sub <= 0) {
        return Math.abs(gateA * 1.0 - sub);
      }
      return 0;
    },
  
  setParams: function OI_setParams(leagueName, time1, time2, homeTeam, awayTeam,
                      homeScore, awayScore, homeGates, awayGates, gate,
                      homeLevel, awayLevel, homeLevelID, awayLevelID) {
      this.leagueName = leagueName;
      this.time1 = time1;
      this.time2 = time2;
      this.homeTeam = homeTeam;
      this.awayTeam = awayTeam;
      this.homeScore = homeScore;
      this.awayScore = awayScore;
      this.homeGates = homeGates;
      this.awayGates = awayGates;
      this.gate = gate;
      this.homeLevel = homeLevel;
      this.awayLevel = awayLevel;
      this.homeLevelID = homeLevelID;
      this.awayLevelID = awayLevelID;  
  }
}

function LevelInfo() {
  this.homeTeam = '';
  this.awayTeam = '';
  this.gate = '';
  this.levelSub = '';  
  this.levelPos = '';
  this.lijiHomeLevel = '';
  this.lijiAwayLevel = '';
  this.shabaHomeLevel='';
  this.shabaAwayLevel = '';
  this.newballHomeLevel = '';
  this.newballAwayLevel = '';
  this.homeWebLevelID = '';
  this.homeWebLevel = '';
  this.awayWebName = '';
  this.awayWebLevel = '';  
  this.awayWebLevelID = '';
}
